package com.xbongbong.parent.factory;

import com.xbongbong.parent.interfaces.BusinessBatchEditService;
import com.xbongbong.pro.enums.SaasMarkEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;
import java.util.Objects;

/**
 * @author 吴峰
 * @date 2022/11/17 14:14
 */
@Component
public class BusinessBatchFactory {


    @Resource
    private Map<String, BusinessBatchEditService> businessBatchUpdateServiceMap;

    public BusinessBatchEditService batchEdit(Integer saasMark, Integer businessType) {
        if (Objects.equals(SaasMarkEnum.PAAS.getCode(), saasMark)) {
            return businessBatchUpdateServiceMap.get(XbbRefTypeEnum.PAAS.getCode());
        } else {
            return businessBatchUpdateServiceMap.get(businessType);
        }
    }
}
